const arr = [10, 9, 8, 7, 6, 5, 5, 4, 3, 2, 1];

function insertSort(arr) {
    for (let i = 1; i < arr.length; i++) {
        const temp = arr[i]
        let count = i - 1;
        for (; count >= 0 && arr[count] > temp; count--) {
            arr[count + 1] = arr[count]
        }
        arr[count + 1] = temp
    }
    return arr
}


console.log(insertSort(arr))